package com.zhenhua.server.dao.impl;

import java.util.List;

import com.common.entity.Charge;
import com.zhenhua.dao.IChargeDao;
import com.zhenhua.dao.impl.ChargeDaoImpl;
import com.zhenhua.server.dao.IChargeServer;

public class ChargeServerImpl implements IChargeServer{

	public IChargeDao iChargeDao=new ChargeDaoImpl();

	public String getNameById(int id) {
		String name=iChargeDao.getNameById(id);
		return name;
	}

	@Override
	public List<Charge> getAll(int flag) {
		return iChargeDao.getAll(flag);
	}

	@Override
	public int getNumByName(String chargeName) {
		
		return iChargeDao.getNumByName(chargeName);
	}

	@Override
	public List<Charge> listAll() {
		
		return iChargeDao.listAll();
	}

	@Override
	public int addCharge(Charge charge) {
		
		return iChargeDao.addCharge(charge);
	}

	@Override
	public boolean deleteByIds(int... ids) {
		boolean isYes = false;
		try {
			for (int i = 0; i < ids.length; i++) {
				iChargeDao.deleteChargeById(ids[i]);
			}
			isYes = true;
		} catch (Exception e) {
			isYes = false;
			e.printStackTrace();
		}
		return isYes;
	}

	@Override
	public Charge getChargeById(int id) {
		
		return iChargeDao.getChargeById(id);
	}

	@Override
	public int updateCharge(Charge charge) {
		
		
		return iChargeDao.updateChargeById(charge);
	} 


}
